<#import "/META-INF/spring.ftl" as spring />
<!DOCTYPE HTML>
<html lang="en-US">
<head>
	<meta charset="UTF-8">
	<title>M-LOG后台管理登录</title>
	<link rel="icon" type="image/png" href="${base}/images/favicon.ico" />
	<link rel="stylesheet" type="text/css" href="${base}/style/login.css">
	<script type="text/javascript" src="${base}/script/jquery.js"></script>
	<script type="text/javascript" src="${base}/script/jquery.form.js"></script>
</head>
<body class="login">
	<div class="wrapper">
		<form id="loginForm" action="${base}/admin/login/do" method="post" >
			<div class="loginBox">
				<div class="loginBoxCenter">
					<p><label for="username">用户名：</label></p>
					<p>
						<input type="text" id="name" name="name" class="loginInput" autofocus="autofocus" autocomplete="off" placeholder="请输入用户名"/>
					</p>
					<p><label for="password">密码：</label></p>
					<p>
						<input type="password" id="password" name="password" class="loginInput" placeholder="请输入密码" />
					<p>
					<p>
						<label for="password">验证码：</label><img id="validateCode" src="${base}/common/validateCode" />&nbsp;&nbsp;<a href="javascript:changeImg();">换一张</a>
					</p>
					<p>
						<input name="code" class="loginInput" placeholder="请输入验证码" />
					<p>
					<p>
						<input type="checkbox" name="rememberMe" id="rememberMe" /><label for="rememberMe" style="cursor:pointer;">记住登录状态</label>
					</p>
				</div>
				<div class="loginBoxButtons" style="text-align:center;">
					<input type="submit" class="loginBtn" value="登录" style="width:120px;" />
				</div>
			</div>
		</form>
	</div>
</body>
<script type="text/javascript">
	function changeImg(){
		var img = document.getElementById('validateCode');
		img.src = "${base}/common/validateCode?s=" + (new Date().getTime());
	}
	
	$(document).ready(function(){
    	$("#loginForm").ajaxForm({
    		success: function(response){
    			if(response.success){
					window.location.href = '${base}/admin/index';
				}
				else{
					alert(response.message);
					changeImg();
				}
    		}
    	});
	});
</script>
</html>